package adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import bean.ExerciseBookBean;
import bean.WorkBean;
import student.andlei.com.student.R;
import utils.GlideUtils;

public class ExerciseBookAdapter extends BaseQuickAdapter<ExerciseBookBean,BaseViewHolder> {
    private Context context;
    //private int type;
    public ExerciseBookAdapter(Context context,int layoutResId, @Nullable List<ExerciseBookBean> data) {
        super(layoutResId, data);
        this.context = context;
       // this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, ExerciseBookBean item) {
        helper.setText(R.id.tv_subject,item.subject_name);
        GlideUtils.loadImageView(context,item.subject_image, (ImageView) helper.getView(R.id.img_subject));
        helper.setText(R.id.tv_nofinish,"本周新增："+item.week_sum+"题");
        if(item.type == 1){
            helper.setText(R.id.tv_finish,"共"+item.sum+"好题");
        }else {
            helper.setText(R.id.tv_finish,"共"+item.sum+"错题");
        }

    }
}
